import mongoose, { Schema, Document } from 'mongoose';

export interface IPost extends Document {
    cover: String;
    title: string;
    content: Array<any>;
    author: string;
    auth: string;
}

const PostSchema: Schema = new Schema({
    title: { type: String, required: true },
    content: { type: Array, required: true },
    author: { type: String },
    cover: { type: String, default: "https://novel.tingroom.com/template/default/tingnovel/images/defaultpic.gif" },
    auth: { type: String, default: "all" },
}, { timestamps: true });

export default mongoose.models.Post || mongoose.model<IPost>('Post', PostSchema);
